<title>回复板</title>
<link rel="icon" href="./../img/logo.png">
<style>
	body{
		margin: 0;
		
	}
	
	.t{
		height: 50px;
		width: 200px;
		margin: 0 auto;
		
	}
	.t p{
		line-height: 50px;
		color: #1E90FF;
		text-align: center;
	}
	.liuyan{
		margin: 0 auto;
		width: 1345px;
		height: 648px;
		background-image: url(../img/zhuce.jpg);
		position: absolute;
	}
	.f .i1{
		
		height: 45px;
		width: 300px;
		margin-top: 80px;
		
		background-color: #4E495D;
		  border-radius: 8px;
		  margin-bottom: 20px;
		  padding: 0 16px;
		  font-size: 18px;
		  color: #c4c3ca;
		  font-weight: 500;
		  outline: none;
		  border: none;
		  box-shadow: 0 4px 8px 0 rgba(78, 73, 79, .5);
		  transform-style: preserve-3d;
		  transform: translate3d(0, 0, 1px);
	}
	.f .i2{
		height: 45px;
		width: 300px;
		background-color: #4E495D;
		  border-radius: 8px;
		  margin-bottom: 20px;
		  padding: 0 16px;
		  font-size: 18px;
		  color: #c4c3ca;
		  font-weight: 500;
		  outline: none;
		  border: none;
		  box-shadow: 0 4px 8px 0 rgba(78, 73, 79, .5);
		  transform-style: preserve-3d;
		  transform: translate3d(0, 0, 1px);
	}
	.f .i3{
		height: 45px;
		width: 300px;
		background-color: #4E495D;
		  border-radius: 8px;
		  margin-bottom: 20px;
		  padding: 0 16px;
		  font-size: 18px;
		  color: #c4c3ca;
		  font-weight: 500;
		  outline: none;
		  border: none;
		  box-shadow: 0 4px 8px 0 rgba(78, 73, 79, .5);
		  transform-style: preserve-3d;
		  transform: translate3d(0, 0, 1px);
	}
	.f{
		width: 250px;
		height: 375px;
		margin-left: 800px;
		position: absolute;
	}
	
	.container{
		width: 100px;
		height: 100px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text-align: center;
		margin-top: -10px;
		margin-left: 100px;
	}
	#rec{
		fill:transparent;
		stroke:tomato;
		stroke-width: 12px;
		stroke-dasharray: 100 500;
		stroke-dashoffset: 230;
	}
	.btn{
		position: relative;
		width: 240px;
		height: 50px;
	}
	.nav{
		font-size: 23px;
		position: relative;
		top:-50px;
		letter-spacing: 6px;
	}
	@keyframes move{
		to{
			stroke-width: 4px;
			stroke-dasharray: 600;
			stroke-dashoffset: 0;
		}
	}
	.btn:hover #rec{
		animation: move 0.8s linear forwards;
	}
	.an{
		width: 235px;
		height: 50px;
		background-image: url(../img/kong.jpg);
		margin-top: -5px;
		border: 0;
	}
</style>

<body>
	<div class="liuyan">
<div class="t">
	<p>您正在回复用户
	<?php
		echo $_GET['id'];
	?>
	的留言
	</p>
</div>

<?php
	/*include('conn.php');*/
	//显示原留言内容
	$conn=mysqli_connect("localhost","root","10a5c81626ac5ee2","message") or die("数据库链接失败！");
	$sql="select * from `message` where id=".$_GET['id'];
	$query=mysqli_query($conn,$sql);
	$rs=mysqli_fetch_array($query);
?>

	<table cellspacing="1" border="1" align="center" width="800">
		<tr>
			<td  width="400">用 户 名:<?php echo $rs['usename']."<br/>"; ?> </td>
			<td  width="400">E - mail:<?php echo $rs['email']."<br/>"; ?> </td>
		</tr>
		<tr >
			<td  colspan="2"><?php echo "留言内容:".$rs['content']."<br/><br/>"; ?> </td>
		</tr>
	</table>

		<!--回复留言的表单-->
		<form action="" method="post" class="f">
			<input type="text" name="usename" class="i1" placeholder="用户名"/><br /><br />
			<input type="text" name="email" class="i2" placeholder="E-mail:"/><br /><br />
			<textarea name="content" class="i3" placeholder="留言板："></textarea><br /><br />
			<div class="container">
				<div class="btn">
					<svg width="240" height="60">
						<rect width="240" height="60" id="rec"/>
					</svg>
					<div class="nav">
						<input type="submit" name="post" value="回复" class="an"/>
					</div>
				</div>
			</div>
			
		</form>
</div>
<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
	<br/><br/><br/><br/>
		<?php
			//把回复内容放入回复表中
			if(isset($_POST['post'])){
			    $conn=mysqli_connect("localhost","root","10a5c81626ac5ee2","message") or die("数据库链接失败！");
				$sql="insert into `reply` (`id`,`mid`,`usename`,`email`,`content`,`time`) 
				values('','$_GET[id]','$_POST[usename]','$_POST[email]','$_POST[content]',now())";
				$result=mysqli_query($conn,$sql);
				if($result)
					echo "回复成功";
				else
					echo "回复失败";
			}
			//把回复内容显示在浏览器上
			$sql="select * from reply where mid=".$_GET['id'];
			$query=mysqli_query($conn,$sql);
			$nums=mysqli_num_rows($query);
			echo "<br /><br /><br /><br />";
			if($nums!=0){
				while($replyRs=mysqli_fetch_array($query)){
			//每一条的回复内容
		?>
		<br />
			<!--通过表格装饰显示-->
			<table cellspacing="0" border="1" align="center" width="800">
				<tr>
					<td  width="400">用 户 名:<?php echo $replyRs['usename']."<br/>"; ?> </td>
					<td width="400">E - mail:<?php echo $replyRs['email']."<br/>"; ?> </td>
				</tr>
				<tr >
					<td colspan="2">留言内容:<?php echo $replyRs['content']."<br/><br/>"; ?> </td>
				</tr>
			</table>
		<?php
				}
			}
			else {
		?>
		<div class="t">
			<br /><br /><br /><br />
			<p>该留言目前没有回复哦~</p>
		</div>
		<?php
			}
		?>
		
</body>